<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<?php include "../public/header_edit.php"?>
<script src="/static/admin/js/math.js"></script>
<link rel="stylesheet" type="text/css" href="/static/admin/css/main.css">
<style>
    #type_content{padding-top: 38px}
    #type_content button{width: 80%;margin-left: 10%!important;margin-top:10px;height: 35px;line-height: 29px;}
    #type_content .active{background-color:#2272eb;color: #FFFFFF}
</style>
<body class="laytp-container">
<div style="height: 45px"></div>
<div id="opt_nav">
</div>
<div id="dialog">
    <div class="page-title" id="page-title">
        <div class="page-title-con">
            <span class="title" id="titss"></span>
            <div class="move_title"></div>
            <div class="page-title-opt-list">
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
</div>
<?php include "dao.php"?>

<div class="layui-card layui-hide" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <input type="hidden" id="type" name="type">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md2" style="width: 150px!important;">
                <div id="type_content">
                    <button class="layui-btn layui-btn-primary" key="1" type="button">人工费</button>
                    <button class="layui-btn layui-btn-primary" key="2" type="button">材料费</button>
                    <button class="layui-btn layui-btn-primary" key="3" type="button">机械费</button>
                    <button class="layui-btn layui-btn-primary" key="4" type="button">分包费</button>
                </div>
            </div>
            <div class="layui-col-md10" style="width: calc(100% - 150px)!important;" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>




    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        $("#type_content button").click(function () {
            $("#type_content button").removeClass('active');
            $(this).addClass('active');
            var type = $(this).attr('key') || 0;
            $("#type").val(type);
            searchTableFunc(form, table)
        });

        setSouTableExport('工料机汇总');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_main_gongji_list),where: {enginid:param_enginid}, page: true, height: 'full-120'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.total,
                    "data": res.data.data
                };
            }
            , cols: [[
                {type: 'numbers',title:'序号',width:50}
                ,{field:'basetype',title:'类别',minWidth:100}
                ,{field:'name',title:'名称',minWidth:200}
                ,{field:'guige',title:'规格型号',minWidth:400}
                ,{field:'valunit',title:'单位',minWidth:80}
                ,{field:'price',title:'单价(元)',minWidth:80}
                ,{field:'number',title:'数量',minWidth:80}
                ,{field:'money',title:'合价',minWidth:80}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });

        listTableSearch(form, table);
    });

</script>
</body>
</html>
